package com.bite.messageQueue.mqServer.core;

import java.io.Serializable;

/**
 * 消息属性
 */
public class BasicProperties implements Serializable {
    //消息ID,用于唯一标识一条消息，使用UUID类创建
    private String messageID;
    /**消息暗号,和bindingKey匹配
     * 用于DIRECT交换机时，routingKey表示要转发到的队列
     * 用于FANOUT交换机时，routingKey无意义
     * 用于TOPIC交换机时，routingKey先与binding进行匹配，匹配成功后将消息转发到的对应的队列
     */
    private String routingKey;
    //表示消息是否进行持久化，1表示不持久化，2表示持久化
    private int deliverMode = 1;

    public BasicProperties() {
    }

    public BasicProperties(String messageID, String routingKey, int deliverMode) {
        this.messageID = messageID;
        this.routingKey = routingKey;
        this.deliverMode = deliverMode;
    }

    /**
     * 获取
     * @return messageID
     */
    public String getMessageID() {
        return messageID;
    }

    /**
     * 设置
     * @param messageID
     */
    public void setMessageID(String messageID) {
        this.messageID = messageID;
    }

    /**
     * 获取
     * @return routingKey
     */
    public String getRoutingKey() {
        return routingKey;
    }

    /**
     * 设置
     * @param routingKey
     */
    public void setRoutingKey(String routingKey) {
        this.routingKey = routingKey;
    }

    /**
     * 获取
     * @return deliverMode
     */
    public int getDeliverMode() {
        return deliverMode;
    }

    /**
     * 设置
     * @param deliverMode
     */
    public void setDeliverMode(int deliverMode) {
        this.deliverMode = deliverMode;
    }

    @Override
    public String toString() {
        return "BasicProperties{messageID = " + messageID + ", routingKey = " + routingKey + ", deliverMode = " + deliverMode + "}";
    }
}
